package com.centerm.common.constant.enums.project;

import com.centerm.common.constant.StatusCode;

/**
 * @ClassName MilestoneStatus
 * @Description: 里程碑状态枚举类
 * @author czy
 * @date 2017年9月7日
 */
public enum MilestoneStatus implements StatusCode {

    WAITING(0, "未启动"),
    RUNNING(1, "执行中"),
    SUBMIT(2, "提交"),
    FINISH_TO_REVIEW(3, "评审中"),   
    REVIEW_SUCCESS(4, "评审通过"),
    REVIEW_FAILED(5, "评审不通过");

    private Integer code;
    private String description;
    
    private MilestoneStatus(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public Integer getCode() {
        return this.code;
    }


    @Override
    public String getDescription() {
        return this.description;
    }

    public static MilestoneStatus getByCode(Integer code) {
        for(MilestoneStatus status : MilestoneStatus.values()) {
            if(status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }


    public static String getDescriptionByCode(Integer code) {
        for(MilestoneStatus status : MilestoneStatus.values()) {
            if(status.getCode().equals(code)) {
                return status.getDescription();
            }
        }
        return null;
    }
}
